<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Group extends Model
{
    use SoftDeletes;

    protected $fillable = ['user_id', 'site_id', 'name', 'place', 'description'];

    public static function getGroupsTotalByUserId($user_id)
    {
        $total = Group::where('user_id', $user_id)->count();
        return $total;
    }

    public static function getGroupsBySiteId($site_id)
    {
        $groups = Group::where('site_id', $site_id)->get();
        return $groups;
    }

    public static function getGroupsTotalBySiteId($site_id)
    {
        $total = Group::where('site_id', $site_id)->count();
        return $total;
    }
}
